{include file="public/layout.htm" /}
<style type="text/css">
    .show {display: block;}
    .none {}
</style>
<body class="back-c">
    <div class="ey-content">
        <div class="form-title">填写物流信息</div>
        <form id="postForm">
            <input type="hidden" name="status" value="6">
            <input type="hidden" name="last_one" value="{$Service.last_one}">
            <input type="hidden" name="users_id" value="{$Service.users_id}">
            <input type="hidden" name="order_id" value="{$Service.order_id}">
            <input type="hidden" name="order_code" value="{$Order.order_code}">
            <input type="hidden" name="order_status" value="{$Order.order_status}">
            <input type="hidden" name="details_id" value="{$Service.details_id}">
            <input type="hidden" name="service_id" value="{$Service.service_id}">
            <input type="hidden" name="product_id" value="{$Service.product_id}">
            <input type="hidden" name="service_type" value="{$Service.service_type}">
            <div class="item-wrap mt0">
                <div class="form-wrap more-wrap">
                    <div class="label"><span>收货人</span></div>
                    <div class="value">{$Order.consignee}</div>
                </div>

                <div class="form-wrap more-wrap">
                    <div class="label"><span>联系方式</span></div>
                    <div class="value">{$Order.mobile}</div>
                </div>

                <div class="form-wrap more-wrap">
                    <div class="label"><span>收货地址</span></div>
                    <div class="value">{$Order.province}-{$Order.city}-{$Order.district}-{$Order.address}</div>
                </div>

                <div class="form-wrap more-wrap">
                    <div class="label">
                        <span>物流公司</span>
                    </div>
                    <div class="ey-input">
                        <div class="selected">
                            <input type="hidden" name="delivery[express_id]" id="express_id">
                            <input type="hidden" name="delivery[express_code]" id="express_code">
                            <input type="hidden" name="delivery[name]" id="express_name">
                            <select class="" id="select_express" onchange="selectExpress(this);">
                                <option value="0">请选择物流公司</option>
                                {volist name="$express" id="vo"}
                                <option value="{$vo.express_id}" code="{$vo.express_code}" name="{$vo.express_name}">{$vo.express_name}</option>
                                {/volist}
                            </select>
                        </div>
                    </div>
                </div>
                <div class="form-wrap">
                    <div class="label">
                        <span>快递单号</span>
                    </div>
                    <div class="ey-input">
                        <div class="ey-input-wrapper">
                            <input type="text" name="delivery[code]" id="deliveryCode" class="ey-input-input" placeholder="请输入快递单号">
                        </div>
                    </div>
                </div>
            </div>
        </form>

        <div class="w100-footer-wrap fixed-footer-wrap">
            <button class="w50-btn-no" id="unifiedJump" onclick="unifiedJump(this);" data-url="{:weapp_url('Mbackend/Shop/after_service_details', ['service_id' => $Service.service_id])}">返回</button>
            <button class="w50-btn" onclick="submitServiceResend();">确定</button>
        </div>
    </div>

    <script type="text/javascript">
        // 下拉框选择
        function selectExpress(obj) {
            // 选中的对象
            var selectObj = $(obj).find("option:selected");
            // 赋值隐藏域
            $('#express_id').val($(selectObj).attr('value'));
            $('#express_name').val($(selectObj).attr('name'));
            $('#express_code').val($(selectObj).attr('code'));
        }

        // 表单提交
        function submitServiceResend() {
            var expressName = $('#express_name').val();
            if (!expressName) {
                layerMsg('请选择快递公司', 1);
                return false;
            }
            var deliveryCode = $('#deliveryCode').val();
            if (!deliveryCode) {
                layerMsg('请填写快递单号', 1);
                $('#deliveryCode').focus();
                return false;
            }
            layerLoading();
            $.ajax({
                type: "post",
                url : "{:url('ShopService/after_service_handle', ['_ajax'=>1, 'weappAjax'=>1])}",
                data: $('#postForm').serialize(),
                dataType: 'json',
                success: function (res) {
                    layer.closeAll();
                    if (res.code == 1) {
                        layerMsg(res.msg, 1, function() {
                            $('#unifiedJump').click();
                        });
                    } else {
                        layerAlert(res.msg);
                    }
                },
                error:function(e){
                    layer.closeAll();
                    layerAlert(e.responseText);
                }
            });
        }
    </script>
</body>
{include file="public/footer.htm" /}